/*
 * @Author: mayating mayating@xinchan.com.cn
 * @Date: 2024-06-26 10:48:00
 * @LastEditors: mayating mayating@xinchan.com.cn
 * @LastEditTime: 2024-06-26 18:26:50
 * @FilePath: /wuniubi/src/router/index.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
//index.js
import Vue from 'vue';
import VueRouter from 'vue-router';
Vue.use(VueRouter);

const routes = [
  // {
  //   path: '/Index',
  //   name: 'Index',
  //   component: () => import('@/components/HelloWorld.vue'),
  // },
  {
    path: '/Scroll',
    name: 'Scroll',
    component: () => import('@/components/SCrollView.vue'),
  },
  {
    path: '/Footer',
    name: 'Footer',
    component: () => import('@/views/footer/index.vue'),
  },
  {
    path: '',
    name: 'Home',
    component: () => import('@/views/home/index.vue'),
  },
  
];

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes,
    scrollBehavior(to, from, savedPosition) {
        if (savedPosition) {
            return savedPosition
        } else if (to.hash) {
          return {
            selector: to.hash
          };
        } else {
            return {
                x: 0,
                y: 0
            }
        }
    }
})

export default router;